package org.dreamwork.tools.code.analyzer.core.service.impl;

import org.dreamwork.db.SQLite;
import org.dreamwork.tools.code.analyzer.core.service.IBaseService;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

public abstract class AbstractBaseServiceImpl implements IBaseService {
    @Resource (name = "sqlite/analyzer")
    protected SQLite sqlite;

    @Override
    public void save (Object bean) {
        sqlite.save (bean, false);
    }

    @Override
    public void update (Object bean) {
        sqlite.update (bean);
    }

    @Override
    public <T> List<T> all (Class<T> type) {
        return sqlite.get (type);
    }

    @Override
    public <T> T getByPrimary (Class<T> type, Serializable pk) {
        return sqlite.getByPK (type, pk);
    }
}
